[verify] #268 test fails without fix on rebased master (do not merge)#271
Closed
yahonda wants to merge 1 commit intorsim:masterfrom
Closed
[verify] #268 test fails without fix on rebased master (do not merge)#271yahonda wants to merge 1 commit intorsim:masterfrom
yahonda wants to merge 1 commit intorsim:masterfrom
Conversation
Capture deprecation warnings emitted while resolving plsql.default_timezone with `activerecord_class` set, and assert that no warning mentioning `default_timezone` was raised. The test_gemfiles workflow exercises every supported ActiveRecord version (5.0 through 8.0), so this test will catch any future regression that re-introduces a call to the deprecated per-class `default_timezone` accessor on AR 7.0/7.1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
Collaborator
Author
|
Verification complete. Confirmed AR 7.0 fails on the regression test in #268 with the deprecation warning, and AR 7.1+ pass (because the deprecated per-class accessor was removed in rails/rails@96c9db1). Closing without merging. |
yahonda
added a commit
to yahonda/ruby-plsql
that referenced
this pull request
Apr 14, 2026
Calling `ar_class.default_timezone` on Rails 7.0.x prints DEPRECATION WARNING: ActiveRecord::Base.default_timezone is deprecated and will be removed in Rails 7.1. Use ActiveRecord.default_timezone instead. even though both accessors return the same value. The per-class accessor was introduced as a deprecated proxy in Rails 7.0 (rails/rails@c3f43075a3) and removed entirely in Rails 7.1 (rails/rails@96c9db1b48), so the warning only fires on Rails 7.0.x. Switch the order in PLSQL::Schema#default_timezone so that we ask the module-level ActiveRecord.default_timezone first when it is available (AR 7.0+) and only fall back to the per-class accessor on pre-7.0 AR where the module-level one does not exist. This silences the warning on Rails 7.0.x and is a no-op on Rails 7.1+ (where the per-class accessor was already gone) and on Rails <= 6.x (where the module-level accessor did not yet exist). Add a regression test that captures deprecator output while resolving plsql.default_timezone with `activerecord_class` set, and asserts that no warning mentioning default_timezone was raised. The existing ActiveRecord.default_timezone is captured before assignment and restored from the ensure block alongside the deprecator behavior so the test is order-independent. Verified by rsim#269 / rsim#271 that the test fails on AR 7.0 without this fix and passes on AR 7.1+ regardless. Fixes rsim#234 References: - rails/rails@c3f43075a3 (added the deprecated delegators in Rails 7.0) - rails/rails@96c9db1b48 (removed them in Rails 7.1) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Do not merge. Verification PR for #268.
This branch contains only the regression test from #268 (without the fix in
lib/plsql/schema.rb), rebased on top of the new master after #259 was merged.Expected results
ActiveRecord::Base.default_timezoneexists as a deprecated proxy that prints"is deprecated and will be removed in Rails 7.1"before forwarding toActiveRecord.default_timezone. The OLD code path inPLSQL::Schema#default_timezonecalls the per-class accessor and the deprecation fires; the test captures the warning and asserts it shouldn't be there.ActiveRecord::Base.default_timezoneentirely in rails/rails@96c9db1 (March 2023, shipped in 7.1). With the per-class accessor gone,ar_class.respond_to?(:default_timezone)returnsfalseand the OLD code already falls through toActiveRecord.default_timezone— no warning.ActiveRecorddoesn'trespond_to?(:default_timezone=), so the test skips before exercising any code under test.Observed (CI on this PR)
schema_spec.rb:221with the exact deprecation message from ActiveRecord::Base.default_timezone is deprecated and will be removed in Rails 7.1 #234.This confirms #268's test correctly catches the bug on Rails 7.0.x. PR will be closed without merging.